<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page import="com.yaodian100.core.common.utils.ServerValue"%>
<%@ include file="/taglibs.jsp"%>
<c-rt:set var="midContextPath" value='<%=ServerValue.getMidContextPath()%>'/>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.alphanumeric.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="/css/ui.jqgrid.css" />
<script src="/js/grid.locale-en.js" type="text/javascript"></script>
<script src="/js/jquery.jqGrid.min.js" type="text/javascript" charset="UTF-8"></script>
<s:url var="supplierPops" value="/json/supplierPops.do"/>
<s:url value="/images" var="imgPath"/>
<link rel="stylesheet" type="text/css" href="/css/smoothness.datepick.css" />
<script type="text/javascript" charset="UTF-8" src="/js/jquery.datepick.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.datepick-zh-CN.js"></script>
<link rel="stylesheet" href="/css/jquery.tooltip.css" />
<script src="/js/jquery.tooltip.min.js" type="text/javascript"></script>
<script language="javascript">
	var content;
	$().ready(function(){
		$("tr[id*='tdDesc_']").tooltip();
		$("#applyDateParam").datepick({showOn:'both',numberOfMonths:2, buttonImageOnly: true, buttonImage: '${imgPath}/calendar.gif',dateFormat:"yy-mm-dd"});
		$("#productIdParam").numeric();
		$("#supplierParam").numeric();
		$("#getSupplier").click(function() {
			doAR('${supplierPops}', 'dialog'); 
			openDialog('供应商搜寻',content, 550, 440);
		});	 
		$("#searchbtn").click(function(){
			$("#productSearchForm").submit();
		});
	});
	function chk24hr(psId){
		$("#hidId").val(psId);
		$.post("${midContextPath}/productSupplierApprove/jsonChk24Hr.do",{id:psId},callback,"json");
	}
	function callback(hr24Result){
		location.href="${midContextPath}/productSupplierApprove/edit.do?id=" + $("#hidId").val();
		/*
		if ( null == hr24Result )
			location.href="${midContextPath}/productSupplierApprove/edit.do?id=" + $("#hidId").val();
		else
			alert(hr24Result);
		*/
		return false ;
	}	
</script>
<h1>商品供应商修改审核-查询</h1>
<s:actionerror />
<s:actionmessage />
<s:fielderror />
<br/>
<div class="data-form">
	<s:form action="search.do" method="post" id="productSearchForm">
		<b>商品编号：</b>
		<input name="productIdParam" id="productIdParam" type="text" title="商品编号" size="10" value="${productIdParam}" >
	  <b>申请人：</b>
  	<s:select name="applyUserParam" list="users" listKey="username"  listValue="nameNative" headerKey="" headerValue="全部"/>
  	<br/>
		<b>新供应商：</b>
		<s:textfield name="supplierParam" id="supplierIdParam" maxlength="6"/>
				<img class="ui-icon ui-icon-search" src="/images/none.gif" style="height:16px; width:16px; position:relative; display:inline;" 
							id="getSupplier"/>
				<!-- <input type="text" id="supplierCompanyName" value="${supplierCompanyName}" readonly="readonly" size="30" style="border: 0px;"/> -->
	  <b>申请日期：</b>
  	<input name="applyDateParam" id="applyDateParam" size="10" maxlength="10" value="${applyDateParam}">  	
		<input type="button" id="searchbtn" value="查询"/>	
	</s:form>
</div>
<br/>
<table class="tb-1" width="100%">
	<thead>
		<tr>
			<th>申请日期</th>
			<th>商品编号</th>
			<th width="15%">商品名称</th>
			<th width="10%">原供应商</th>
			<th>原成本</th>
			<th width="10%">新供应商</th>
			<th>新成本</th>
			<th>申请人</th>
			<th>审核人</th>
			<th>审核时间</th>
			<th>状态</th>
			<th>处理</th>
		</tr>
	</thead>
	<tbody>
		<c-rt:choose>
			<c-rt:when test="${not empty productSupplierApproveList}">
				<c-rt:forEach items="${productSupplierApproveList}" var="productSupplierApprove" varStatus="index">
					<tr  id="tdDesc_${index.count}" title="建立者:${productSupplierApprove.createUser} 建立日期:${productSupplierApprove.createDate}<br/>修改者:${productSupplierApprove.modifyUser} 修改日期:${productSupplierApprove.modifyDate}">
						<c-rt:set var="pId" value="${productSupplierApprove.productId}"/>
						<td><fmt-rt:formatDate value="${productSupplierApprove.applyDate}" pattern="yyyy-MM-dd"/></td>
						<c-rt:set var="xx" value="${productMap[pId].supplierId}"/>
						<td>${pId}</td>
						<td>${productMap[pId].productName}</td>
						<td>${supplierApplyMap[productSupplierApprove.oldSupplierId]}</td>
						<td><fmt-rt:formatNumber value="${productSupplierApprove.oldCost}" pattern="######.0#"/></td>
						<td>${supplierApplyMap[productSupplierApprove.newSupplierId]}</td>
						<td><fmt-rt:formatNumber value="${productSupplierApprove.newCost}" pattern="######.0#"/></td>
						<td>${productSupplierApprove.applyUser}</td>
						<td>${productSupplierApprove.approveUser}</td>
						<td><fmt-rt:formatDate value="${productSupplierApprove.approveDate}" pattern="yyyy-MM-dd"/></td>
						<td>${supplierApproveMenu.options[productSupplierApprove.approveStatus].name}</td>
						<td>
							<a href="view.do?id=${productSupplierApprove.id}">查询</a><br/>
							<c-rt:if test="${productSupplierApprove.approveStatus eq '10'}">
								<c-rt:if test="${productSupplierApprove.applyUser eq loginUser}">
									<a href="edit.do?id=${productSupplierApprove.id}">修改</a><br/>
								</c-rt:if>
								<yaodian100:checkPermission permissions="ROLE_PM_MANAGER,MANAGER_A-20-200-100">
									<a href="edit.do?id=${productSupplierApprove.id}&approve=Y">审核</a>
								</yaodian100:checkPermission>
							</c-rt:if>
						</td>
					</tr>
				</c-rt:forEach>
			</c-rt:when>
			<c-rt:otherwise>
				<tr>
					<td colspan="12">查无商品资料</td>
				</tr>
			</c-rt:otherwise>
		</c-rt:choose>
	</tbody>
</table>
<input type="hidden" id="hidId" name="hidId" value=""/>
<yaodian100:pageutil link="search.do" pagerObj="${pager}" />